﻿

(function(){
    fl.runScript(fl.configURI + "jsfl/core.jsfl");
    var p = "E:/ZhangDongCai/Flash/OCT_BoTuoFeiNuo/素材/图片/Location_/button";
    var l = lib();
    var d = dom();
    function imp_dir(path, prev_dir){
        var uri = p2uri(path);
        var fs = FLfile.listFolder(uri);
        var dname = (prev_dir? prev_dir : '') + uri.split('/').last();   //fl.trace('dname:' + dname + ', uri:' + uri + ', path:' + path);
        l.addNewItem('folder', dname);
        for(var i = 0; i < fs.length; i++){
            var f = fs[i];
            var t = FLfile.getAttributes(p2uri(path + "/" + f));        //fl.trace('t:' + t + "," + p2uri(path + "/" + f))
            if(t && t.indexOf('D') > -1){
                var newd = dname + '/' + f;
                var newp = path + '/' + f;                              //fl.trace("dir:" + newd + ", new path:" + newp);
                imp_dir(newp, dname + '/');
            }
            else{
                var fname = dname + '/' + f;
                d.importFile(uri + '/' + f, true);                      //fl.trace('file name:' + uri + '/' + f + " fname: " + fname );
                l.moveToFolder(dname, f);
            }
        }
    }
    imp_dir(p);

})();